<?php @session_start();?>
<?php
require_once('./safe.php');
require_once('../admin/config.php');
$conn = mysql_connect($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd);
mysql_select_db($cfg_dbname,$conn);
$sql="select * from ph_user where user_name='".$_SESSION["username"]."'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$sqltdk="select * from ph_tdk where 1=1";
$resulttdk=mysql_query($sqltdk);
$rowtdk=mysql_fetch_array($resulttdk);
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

                    <link rel="apple-touch-icon" sizes="180x180" href="/images/iosinstalls/favicon/apple-touch-icon.png">

            <meta name="theme-color" content="#ffffff">

        <title><?php echo $rowtdk["sitename"];?> - Dashboard</title>

        <link href="../css/customer-iosinstalls.css?id=a9a9c5930bcdb195e9ee" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="<?php if(!empty($rowtdk["fontlink"])){echo '//fonts.googleapis.com/css?family='.$rowtdk["fontlink"];}else{echo "//fonts.googleapis.com/css?family=Roboto:300,400,500";}?>">
        <style type="text/css">
            body{font-family: '<?php echo $rowtdk["fontlink"];?>';}
        </style>
    </head>

    <body class="app header-fixed sidebar-fixed aside-menu-fixed aside-menu-hidden">
    <?php include("head.php");?> 
    <?php include("left.php");?>

            <!-- Main content -->
            <main class="main">
                    <div class="container-fluid padding-top">
        <div class="row">
            <div class="col-md-6">
                <div class="card">
                    <div class="card-header">
                        <i class="fa fa-edit"></i> Settings
                    </div>
                    <div class="card-body">
                        <div id="info" class="alert alert-info hidden">
                            
                        </div>

                        <div id="success" class="alert   hidden">
                            
                            
                        </div>

                        <form id="settings" action="/dashboard/save-settings.php" method="POST">
                            <input type="hidden" name="_token" value="msjakyaVfXhrVLos7cEHEiYtLZESKcd6bzZrxPK1">

                            <fieldset class="form-group">
                                <label>Country <span class="text-danger">*</span></label>
                                <select id="country" name="country_id" class="selectpicker" autocomplete="off" data-width="100%">
                                    <option value="">Select country</option>
                                                                            <option value="1" >Afghanistan</option>
                                                                            <option value="2" >Aland islands</option>
                                                                            <option value="3" >Albania</option>
                                                                            <option value="4" >Algeria</option>
                                                                            <option value="5" >American Samoa</option>
                                                                            <option value="6" >Andorra</option>
                                                                            <option value="7" >Angola</option>
                                                                            <option value="8" >Anguilla</option>
                                                                            <option value="9" >Antarctica</option>
                                                                            <option value="10" >Antiguaand Barbuda</option>
                                                                            <option value="11" >Argentina</option>
                                                                            <option value="12" >Armenia</option>
                                                                            <option value="13" >Aruba</option>
                                                                            <option value="14" >Australia</option>
                                                                            <option value="15" >Austria</option>
                                                                            <option value="16" >Azerbaijan</option>
                                                                            <option value="17" >Bahamas</option>
                                                                            <option value="18" >Bahrain</option>
                                                                            <option value="19" >Bangladesh</option>
                                                                            <option value="20" >Barbados</option>
                                                                            <option value="21" >Belarus</option>
                                                                            <option value="22" >Belgium</option>
                                                                            <option value="23" >Belize</option>
                                                                            <option value="24" >Benin</option>
                                                                            <option value="25" >Bermuda</option>
                                                                            <option value="26" >Bhutan</option>
                                                                            <option value="27" >Bolivia</option>
                                                                            <option value="28" >Bosnia and Herzegovina</option>
                                                                            <option value="29" >Botswana</option>
                                                                            <option value="30" >Bouvet Island</option>
                                                                            <option value="31" >Brazil</option>
                                                                            <option value="32" >British Indian Ocean</option>
                                                                            <option value="33" >British Virgin Islands</option>
                                                                            <option value="34" >Brunei Darussalam</option>
                                                                            <option value="35" >Bulgaria</option>
                                                                            <option value="36" >Burkina Faso</option>
                                                                            <option value="37" >Burundi</option>
                                                                            <option value="38" >Cambodia</option>
                                                                            <option value="39" >Cameroon</option>
                                                                            <option value="40" >Canada</option>
                                                                            <option value="41" >Cape Verde</option>
                                                                            <option value="42" >Cayman Islands</option>
                                                                            <option value="43" >Central African Republic</option>
                                                                            <option value="44" >Chad</option>
                                                                            <option value="45" >Chile</option>
                                                                            <option value="46" >China</option>
                                                                            <option value="47" >Christmas Island</option>
                                                                            <option value="48" >Cocos (Keeling) Islands</option>
                                                                            <option value="49" >Colombia</option>
                                                                            <option value="50" >Comoros</option>
                                                                            <option value="51" >Congo</option>
                                                                            <option value="52" >Cook Islands</option>
                                                                            <option value="53" >Costa Rica</option>
                                                                            <option value="54" >Croatia</option>
                                                                            <option value="55" >Cuba</option>
                                                                            <option value="56" >Curaçao</option>
                                                                            <option value="57" >Cyprus</option>
                                                                            <option value="58" >Czech Republic</option>
                                                                            <option value="59" >Democratic Republic of the Congo</option>
                                                                            <option value="60" >Denmark</option>
                                                                            <option value="61" >Djibouti</option>
                                                                            <option value="62" >Dominica</option>
                                                                            <option value="63" >Dominican Republic</option>
                                                                            <option value="64" >East Timor</option>
                                                                            <option value="65" >Ecuador</option>
                                                                            <option value="66" >Egypt</option>
                                                                            <option value="67" >El Salvador</option>
                                                                            <option value="68" >Equatorial Guinea</option>
                                                                            <option value="69" >Eritrea</option>
                                                                            <option value="70" >Estonia</option>
                                                                            <option value="71" >Ethiopia</option>
                                                                            <option value="72" >Falkland Islands (Malvinas)</option>
                                                                            <option value="73" >Faroe Islands</option>
                                                                            <option value="74" >Fiji</option>
                                                                            <option value="75" >Finland</option>
                                                                            <option value="76" >France</option>
                                                                            <option value="77" >French Guiana</option>
                                                                            <option value="78" >French Polynesia</option>
                                                                            <option value="79" >French Southern Territories</option>
                                                                            <option value="80" >Gabon</option>
                                                                            <option value="81" >Gambia</option>
                                                                            <option value="82" >Georgia</option>
                                                                            <option value="83" >Germany</option>
                                                                            <option value="84" >Ghana</option>
                                                                            <option value="85" >Gibraltar</option>
                                                                            <option value="86" >Greece</option>
                                                                            <option value="87" >Greenland</option>
                                                                            <option value="88" >Grenada</option>
                                                                            <option value="89" >Guadeloupe</option>
                                                                            <option value="90" >Guam</option>
                                                                            <option value="91" >Guatemala</option>
                                                                            <option value="92" >Guernsey</option>
                                                                            <option value="93" >Guinea</option>
                                                                            <option value="94" >Guinea-Bissau</option>
                                                                            <option value="95" >Guyana</option>
                                                                            <option value="96" >Haiti</option>
                                                                            <option value="97" >Heard Island and Mcdonald Islands</option>
                                                                            <option value="98" >Honduras</option>
                                                                            <option value="99" >Hong Kong</option>
                                                                            <option value="100" >Hungary</option>
                                                                            <option value="101" >Iceland</option>
                                                                            <option value="102" >India</option>
                                                                            <option value="103" >Indonesia</option>
                                                                            <option value="104" >Iran</option>
                                                                            <option value="105" >Iraq</option>
                                                                            <option value="106" >Ireland</option>
                                                                            <option value="107" >Isle of Man</option>
                                                                            <option value="108" >Israel</option>
                                                                            <option value="109" >Italy</option>
                                                                            <option value="110" >Ivory Coast</option>
                                                                            <option value="111" >Jamaica</option>
                                                                            <option value="112" >Japan</option>
                                                                            <option value="113" >Jersey</option>
                                                                            <option value="114" >Jordan</option>
                                                                            <option value="115" >Kazakhstan</option>
                                                                            <option value="116" >Kenya</option>
                                                                            <option value="117" >Kiribati</option>
                                                                            <option value="118" >Kuwait</option>
                                                                            <option value="119" >Kyrgyzstan</option>
                                                                            <option value="120" >Laos</option>
                                                                            <option value="121" >Latvia</option>
                                                                            <option value="122" >Lebanon</option>
                                                                            <option value="123" >Lesotho</option>
                                                                            <option value="124" >Liberia</option>
                                                                            <option value="125" >Libya</option>
                                                                            <option value="126" >Liechtenstein</option>
                                                                            <option value="127" >Lithuania</option>
                                                                            <option value="128" >Luxembourg</option>
                                                                            <option value="129" >Macau</option>
                                                                            <option value="130" >Macedonia</option>
                                                                            <option value="131" >Madagascar</option>
                                                                            <option value="132" >Malawi</option>
                                                                            <option value="133" >Malaysia</option>
                                                                            <option value="134" >Maldives</option>
                                                                            <option value="135" >Mali</option>
                                                                            <option value="136" >Malta</option>
                                                                            <option value="137" >Marshall Islands</option>
                                                                            <option value="138" >Martinique</option>
                                                                            <option value="139" >Mauritania</option>
                                                                            <option value="140" >Mauritius</option>
                                                                            <option value="141" >Mayotte</option>
                                                                            <option value="142" >Mexico</option>
                                                                            <option value="143" >Micronesia</option>
                                                                            <option value="144" >Moldova</option>
                                                                            <option value="145" >Monaco</option>
                                                                            <option value="146" >Mongolia</option>
                                                                            <option value="147" >Montenegro</option>
                                                                            <option value="148" >Montserrat</option>
                                                                            <option value="149" >Morocco</option>
                                                                            <option value="150" >Mozambique</option>
                                                                            <option value="151" >Myanmar</option>
                                                                            <option value="152" >Namibia</option>
                                                                            <option value="153" >Nauru</option>
                                                                            <option value="154" >Nepal</option>
                                                                            <option value="155" >Netherlands</option>
                                                                            <option value="156" >New Caledonia</option>
                                                                            <option value="157" >New Zealand</option>
                                                                            <option value="158" >Nicaragua</option>
                                                                            <option value="159" >Niger</option>
                                                                            <option value="160" >Nigeria</option>
                                                                            <option value="161" >Niue</option>
                                                                            <option value="162" >Norfolk Island</option>
                                                                            <option value="163" >North Korea</option>
                                                                            <option value="164" >Northern Mariana Islands</option>
                                                                            <option value="165" >Norway</option>
                                                                            <option value="166" >Oman</option>
                                                                            <option value="167" >Pakistan</option>
                                                                            <option value="168" >Palau</option>
                                                                            <option value="169" >Palestine</option>
                                                                            <option value="170" >Panama</option>
                                                                            <option value="171" >Papua New Guinea</option>
                                                                            <option value="172" >Paraguay</option>
                                                                            <option value="173" >Peru</option>
                                                                            <option value="174" >Philippines</option>
                                                                            <option value="175" >Pitcairn</option>
                                                                            <option value="176" >Poland</option>
                                                                            <option value="177" >Portugal</option>
                                                                            <option value="178" >Puerto Rico</option>
                                                                            <option value="179" >Qatar</option>
                                                                            <option value="180" >Réunion</option>
                                                                            <option value="181" >Romania</option>
                                                                            <option value="182" >Russian Federation</option>
                                                                            <option value="183" >Rwanda</option>
                                                                            <option value="184" >Saint Barthélemy</option>
                                                                            <option value="185" >Samoa</option>
                                                                            <option value="186" >San Marino</option>
                                                                            <option value="187" >Sao Tome and Principe</option>
                                                                            <option value="188" >Saudi Arabia</option>
                                                                            <option value="189" >Senegal</option>
                                                                            <option value="190" >Serbia</option>
                                                                            <option value="191" >Seychelles</option>
                                                                            <option value="192" >Sierra Leone</option>
                                                                            <option value="193" >Sint Maarten</option>
                                                                            <option value="194" >Singapore</option>
                                                                            <option value="195" >Slovakia</option>
                                                                            <option value="196" >Slovenia</option>
                                                                            <option value="197" >Solomon Islands</option>
                                                                            <option value="198" >Somalia</option>
                                                                            <option value="199" >South Africa</option>
                                                                            <option value="200" >South Georgia and the South Sandwich islands</option>
                                                                            <option value="201" >South Korea</option>
                                                                            <option value="202" >South Sudan</option>
                                                                            <option value="203" >Spain</option>
                                                                            <option value="204" >Sri Lanka</option>
                                                                            <option value="205" >St. Helena</option>
                                                                            <option value="206" >St. Kitts and Nevis</option>
                                                                            <option value="207" >St. Lucia</option>
                                                                            <option value="208" >St. Martin</option>
                                                                            <option value="209" >St. Pierre and Miquelon</option>
                                                                            <option value="210" >St. Vincent and Grenadines</option>
                                                                            <option value="211" >Sudan</option>
                                                                            <option value="212" >Suriname</option>
                                                                            <option value="213" >Svalbard &amp; Jan Mayen Islands</option>
                                                                            <option value="214" >Swaziland</option>
                                                                            <option value="215" >Sweden</option>
                                                                            <option value="216" >Switzerland</option>
                                                                            <option value="217" >Syria</option>
                                                                            <option value="218" >Taiwan</option>
                                                                            <option value="219" >Tajikistan</option>
                                                                            <option value="220" >Tanzania</option>
                                                                            <option value="221" >Thailand</option>
                                                                            <option value="222" >Togo</option>
                                                                            <option value="223" >Tokelau</option>
                                                                            <option value="224" >Tonga</option>
                                                                            <option value="225" >Trinidad and Tobago</option>
                                                                            <option value="226" >Tunisia</option>
                                                                            <option value="227" >Turkey</option>
                                                                            <option value="228" >Turkmenistan</option>
                                                                            <option value="229" >Turks and Caicos Islands</option>
                                                                            <option value="230" >Tuvalu</option>
                                                                            <option value="231" >Uganda</option>
                                                                            <option value="232" >Ukraine</option>
                                                                            <option value="233" >United Arab Emirates</option>
                                                                            <option value="234" >United Kingdom</option>
                                                                            <option value="235" >United States</option>
                                                                            <option value="236" >Uruguay</option>
                                                                            <option value="237" >US Outlying Islands</option>
                                                                            <option value="238" >US Virgin Islands</option>
                                                                            <option value="239" >Uzbekistan</option>
                                                                            <option value="240" >Vanuatu</option>
                                                                            <option value="241" >Vatican</option>
                                                                            <option value="242" >Venezuela</option>
                                                                            <option value="243" >Vietnam</option>
                                                                            <option value="244" >Wallis and Futuna Islands</option>
                                                                            <option value="245" >Western Sahara</option>
                                                                            <option value="246" >Yemen</option>
                                                                            <option value="247" >Zambia</option>
                                                                            <option value="248" >Zimbabwe</option>
                                                                    </select>
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>Company</label>
                                <input type="text" class="form-control" id="company" name="company" value="<?php echo $row["company_name"];?>" />
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>Phone<span class="text-danger">*</span></label>
                                <input type="text" class="form-control" id="vat" name="vat" value="<?php echo $row["vat"];?>" />
                                <!--<small class="text-muted">Always include country prefix (ex. LU12345678 for Luxembourg)</small>-->
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>First name <span class="text-danger">*</span></label>
                                <input type="text" class="form-control" id="first_name" name="first_name" value="<?php echo $row["first_name"];?>">
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>Last name <span class="text-danger">*</span></label>
                                <input type="text" class="form-control" id="last_name" name="last_name" value="<?php echo $row["last_name"];?>"/>
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>Address <span class="text-danger">*</span></label>
                                <input type="text" class="form-control" id="address" name="address" value="<?php echo $row["address"];?>" />
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>Postcode <span class="text-danger">*</span></label>
                                <input type="text" class="form-control" id="postcode" name="postcode" value="<?php echo $row["postcode"];?>" />
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>City <span class="text-danger">*</span></label>
                                <input type="text" class="form-control" id="city" name="city" value="<?php echo $row["city"];?>" />
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>Email <span class="text-danger">*</span></label>
                                <div class="input-group">
                                    <span class="input-group-prepend">
                                        <span class="input-group-text">
                                            @
                                        </span>
                                    </span>
                                    <input type="email" class="form-control" id="email" name="email" value="<?php echo $row["email"];?>" />
                                </div>
                                                            </fieldset>

                            <fieldset class="form-group">
                                <span class="text-danger">* is required.</span>
                                <br />
                            </fieldset>

                            <button class="btn btn-primary" type="submit" id="save">Save</button>
                        </form>
                    </div>
                </div>
            </div>
            <div class="col-md-6">
                <div class="card">
                    <div class="card-header">
                        <i class="fa fa-edit"></i> Change Password
                    </div>
                    <div class="card-body">
                        <div id="success" class="alert alert-success hidden">
                            
                        </div>

                        <form id="change_password_form" action="/dashboard/change-password.php" method="post">
                            <input type="hidden" name="_token" value="msjakyaVfXhrVLos7cEHEiYtLZESKcd6bzZrxPK1">

                            <fieldset class="form-group">
                                <label>Current password</label>
                                <div class="input-group">
                                    <span class="input-group-prepend">
                                        <span class="input-group-text">
                                            <i class="icon-lock"></i>
                                        </span>
                                    </span>
                                    <input type="password" class="form-control" id="current_password" name="current_password" />
                                </div>
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>New password</label>
                                <div class="input-group">
                                    <span class="input-group-prepend">
                                        <span class="input-group-text">
                                            <i class="icon-lock"></i>
                                        </span>
                                    </span>
                                    <input type="password" class="form-control" id="new_password" name="new_password" />
                                </div>
                                                            </fieldset>

                            <fieldset class="form-group">
                                <label>Repeat password</label>
                                <div class="input-group">
                                    <span class="input-group-prepend">
                                        <span class="input-group-text">
                                            <i class="icon-lock"></i>
                                        </span>
                                    </span>
                                    <input type="password" class="form-control" id="new_password_confirmation" name="new_password_confirmation" />
                                </div>
                                                            </fieldset>

                            <button class="btn btn-primary" type="submit" id="change_password">Change password</button>
                        </form>
                    </div>
                </div>
<!--
                <div class="card">
                    <div class="card-header">
                        API Key
                    </div>
                    <div class="card-body">
                                                    <button href="https://iosinstalls.com/dashboard/tokens/create" class="btn btn-primary" id="createApiKey">Create API Key</button>
                                                <p id="apiKey" class="mb-0 d-none">
                            This is your new API key. <b>SAVE IT NOW</b>, as you won't be able to see it again. If you lose this one, you'll be able to refresh it, but leaves the old one useless.
                            <br />
                            <span id="apiKeyText" class="text-success"></span>
                        </p>
                    </div>
                </div>-->

                <div class="card">
                    <div class="card-header">
                        Other
                    </div>
                    <div class="card-body">
                      
                    </div>
                </div>
            </div>
        </div>
    </div>
            </main>
        </div>

        <footer class="app-footer">
                            &copy; 2021 <?php echo $rowtdk["sitename"];?>. All Rights Reserved
                        <div class="pull-right">
                Server time: <?php echo date('d-m-Y H:i:s',time());?>
            </div>
        </footer>

        <!-- Bootstrap and necessary plugins -->
        <script src="/js/backend.js?id=27298b157affa1f728a9"></script>
        <script src="/js/jquery-1.11.1.min.js"></script>

       <script type="text/javascript">
        $(document).ready(function () {
        $("#country option[value='<?php echo $row["country"];?>']").attr("selected", true);

    });
        $(function(){
            $('#createApiKey, #refreshApiKey').click(function() {
                if ($('#refreshApiKey').length > 0 && confirm("Are you sure you want to refresh your API key? This can not be undone.")) {
                    createApiKey()
                } else if ($('#createApiKey')) {
                    createApiKey()
                }
            })
        })

        function createApiKey() {
            axios.post('https://iosinstalls.com/dashboard/tokens/create').then(response => {
                $('#createApiKey, #refreshApiKey').addClass('d-none')
                $('#apiKey').removeClass('d-none')
                $('#apiKeyText').text(response.data.token)
            }).catch(error => {

            })
        }
    </script>

                        </body>
</html>